Issue #815 - Confusing error message when attempting to use a translated column that doesn't exist#842
Open
Garen6 wants to merge 3 commits intoXLSForm:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why is this the best possible solution? Were any other approaches considered?
This change fixes the problem at the earliest useful point: header parsing. Before this change, a header like form_title::French (fr) was accepted, turned into a nested dict structure, and only failed later during XML generation with the confusing runtime error:
AttributeError: 'dict' object has no attribute 'nodeType'
The new behavior rejects invalid translated headers while parsing sheet columns and raises a clear, user-facing header error that includes the sheet name, full column name, and base column. That is better than a later crash because:
the error is closer to the source of the problem
the message is actionable for form authors
valid translation and grouped-header behavior can still proceed unchanged
I considered implementing a narrow special case just for form_title::..., since that was one of the motivating examples in the issue discussion. I decided against that because the issue is broader: any non-translatable column written in translated form should produce a clear error, not just form_title. The chosen solution generalizes the fix while still allowing supported translated columns and existing grouped headers like attribute::..., media::..., and translated bind/message columns.
What are the regression risks?
Moderate but well contained. The change touches shared header parsing logic, so the main regression risk is accidentally rejecting valid grouped or translated headers.
To reduce that risk, the validation was designed to:
allow known translatable column paths on the relevant sheets
allow valid grouped header roots such as attribute, media, bind, instance, control, and body where appropriate
only raise the new error for recognized columns that are being used in translation form on sheets where that base column is not translatable
I added focused regression tests and also ran nearby translation and namespace/grouped-header tests to confirm the parser still accepts supported cases.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
Maybe, but probably not urgently. This is mainly an error-handling improvement for unsupported usage rather than a change to supported XLSForm behavior. If maintainers want this clarified in user docs, a docs issue could be filed later.